<template>
  <div class="table">
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="id"
        label="ID"
        width="50">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="weight"
        label="体重"
        width="180">
      </el-table-column>
      <el-table-column
        prop="age"
        label="年龄">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {Table,tableColumn} from 'element-ui';
import {getlist} from '@/api/getDatas';

export default {
  name: 'table',
  data() {
    return {
      tableData: []
    }
  },
  components: {
    'el-table': Table,
    'el-table-column': tableColumn
  },
  methods: {
    async getlistAsync() {
      this.tableData = await getlist();

    }
  },
  created() {
    this.getlistAsync();
  }
}
</script>

<style>

</style>
